package com.ita.aspect;

import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Md5Util {

	public static String getMD5(String str){
		try {
			MessageDigest md=MessageDigest.getInstance("MD5");
			byte[] b=str.getBytes("utf-8");
			md.update(b);
			
			return new BigInteger(1, md.digest()).toString(16);
		}catch (UnsupportedEncodingException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();		
		} catch (NoSuchAlgorithmException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return str;
		
	}
	
	public static void main(String[] args) {
		String a="12";
		System.out.println(getMD5(a));
	}
}
